package descriptors;

public class VarDescr extends AbstractDescr {

	
	private boolean isVar;
	private AbstractDescr typeDescr;
	private int address;
	/**
	 * 
	 */
	private static final long serialVersionUID = 8016782575340450121L;

	public VarDescr(int level,int address, boolean isVar,AbstractDescr typeDescr){
		if(isVar){
			this.size=1;
		}
		else{
			this.size=typeDescr.getSize();
		}
		this.level=level;
		this.isVar=isVar;
		this.typeDescr=typeDescr;
		this.address=address;
	}
	
	public int address(){
		return address;
	}
	
	public AbstractDescr type(){
		return typeDescr;
	}
	
	public boolean isVar(){
		return isVar;
	}
	
	@Override
	public void print() {
		trace("VarDescr: "+size+"; level: "+level+"; isVar: "+isVar+"; address:"+address);
		typeDescr.print();
		unindent();
	}

}
